// src/server/client_handler.h
#ifndef CLIENT_HANDLER_H
#define CLIENT_HANDLER_H

#include <pthread.h>
#include "../common/message.h"

class ChatServer; // 前向声明

class ClientHandler {
private:
    int client_socket;
    ChatServer* server;
    pthread_t thread;
    static void* handle_client_static(void* arg);

public:
    ClientHandler(int client_socket, ChatServer* server);
    ~ClientHandler();
    
    void start();     // 启动处理线程
    void stop();      // 停止处理线程
    void handle_client(); // 处理客户端请求
    int getClientSocket() const; // 获取客户端套接字
};

#endif // CLIENT_HANDLER_H    